package com.hotelvip.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hotelvip.dao.ItemTurnMapper;
import com.hotelvip.entity.ItemTurn;
import com.hotelvip.service.ItemTurnService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Lzh
 * @date 2020/12/16 14:13
 */
@Service
public class ItemTurnServiceImpl extends ServiceImpl<ItemTurnMapper, ItemTurn> implements ItemTurnService {
    @Override
    public boolean saveItemTurn(Long itemId,Long[] tIds) {
        List<ItemTurn> itemTurns = new ArrayList<>();
        for (int i = 0; i < tIds.length; i++) {
            itemTurns.add(new ItemTurn().setItemId(itemId).setTId(tIds[i]));
        }
        return this.saveBatch(itemTurns);
    }
}
